package cn.neusoft.service.impl;

import cn.neusoft.exception.AppException;
import cn.neusoft.exception.AppExceptionCodeMsg;
import cn.neusoft.mapper.FoodMapper;
import cn.neusoft.pojo.Food;
import cn.neusoft.service.IFoodService;
import cn.neusoft.vo.ResultBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * extends BaseService<Food> ： 在BaseService中对基本的5个方法已经做了具体实现  模块中不需要实现
 */
@Service
public class FoodService extends BaseService<Food> implements IFoodService {

    @Autowired
    FoodMapper foodMapper;


    @Override
    public ResultBean getByBusinessId(Integer businessId) {

        if (businessId==null || businessId==0){
            throw new AppException(AppExceptionCodeMsg.PARAMS_EMPTY);
        }

        List<Food> foodList = foodMapper.getByBusinessId(businessId);

        return ResultBean.SUCCESS(foodList);
    }
}
